package com.levi.utils;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.math.MathUtil;
import cn.hutool.core.util.RandomUtil;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author shentong
 * @since 2023/1/9 13:52
 */
public class TraceIdUtil {
    public static String getTraceId() {
        LocalDateTime now = LocalDateTime.now();
        StringBuilder sb = new StringBuilder();
        String nowStr = DateUtil.format(now, "yyyyMMddHHmmss");
        String randomStr = RandomUtil.randomNumbers(6);
        return sb.append(nowStr).append(randomStr).toString();
    }


}
